package Demo;

import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-04-26
 * Time: 21:41
 */
class Animal1 {
    public Integer Max1(Integer[] array) {
        Sleep sleep = new Sleep();
        Integer max = array[0];
        for (int i = 0; i < array.length; i++) {
            if ( sleep.compare(max,array[i])< 0) {
                max = array[i];
            }
        }
        return max;
    }
}
class Sleep implements Comparator<Integer> {

    @Override
    public int compare(Integer o1, Integer o2) {
        return o1-o2;
    }
}
public class TestDemo1 {
    public static void main(String[] args) {
        Integer[] array = {1, 2, 3, 4, 5, 6, 7};
        Animal1 animal1 = new Animal1();
        Integer input = animal1.Max1(array);
        System.out.println(input);
    }
}